//
//  NetworkError.swift
//  HinsLive
//
//  Created by haoxian on 2019/4/20.
//  Copyright © 2019 Hins. All rights reserved.
//

import Foundation


enum NetworkError: Error {
    case errorResponse(_ msg: String)
    case serverError
    case responseDataInvalid
    case parseDataError
    case networkDisConnected
}

extension NetworkError: LocalizedError {
    var errorDescription: String? {
        switch self {
        case .errorResponse(let msg):
            return msg
        case .serverError:
            return "服务器出错了"
        case .responseDataInvalid:
            return "服务器返回数据格式错误"
        case .parseDataError:
            return "解析数据出错"
        case .networkDisConnected:
            return "网络不可用"
        }
    }
}



